Option Explicit On 
Option Strict On


Imports TreeCreeper01Interfaces

Friend Class cListFilter
    Implements IListFilter

    Private pName As String
    Private pListFilterItemCollection As Collection


    Public Sub New(ByVal Name As String)
        pName = Name
        pListFilterItemCollection = New Collection
    End Sub


    Public ReadOnly Property Name() As String Implements IListFilter.Name
        Get
            Return pName
        End Get
    End Property


    Public ReadOnly Property Count() As Integer Implements IListFilter.Count
        Get
            Return pListFilterItemCollection.Count
        End Get
    End Property


    Public ReadOnly Property ListFilterItemByIndexBaseOne(ByVal Index As Integer) As IListFilterItem Implements IListFilter.ListFilterItemByIndexBaseOne
        Get
            Dim ListFilterItem As IListFilterItem
            ListFilterItem = CType(pListFilterItemCollection.Item(Index), IListFilterItem)
            Return ListFilterItem
        End Get
    End Property


    Public ReadOnly Property ListFilterItemByUniqueName(ByVal Name As String) As IListFilterItem Implements IListFilter.ListFilterItemByUniqueName
        Get

            Dim ListFilterItem As IListFilterItem
            Try
                ListFilterItem = CType(pListFilterItemCollection.Item(Name), IListFilterItem)
            Catch Exception As Exception
                ListFilterItem = Nothing
            End Try

            Return ListFilterItem
        End Get
    End Property

    Public Function AddListFilterItem(ByVal UniqueKey As String, ByVal Value As Double) As IListFilterItem Implements IListFilter.AddListFilterItem
        Dim ListFilterItem As cListFilterItem
        ListFilterItem = New cListFilterItem(UniqueKey, Value)
        pListFilterItemCollection.Add(ListFilterItem, UniqueKey)
        Return ListFilterItem
    End Function


End Class
